package com.woniuxy.controller;


import com.woniuxy.commons.model.Result;
import com.woniuxy.service.MenuInfoService;
import com.woniuxy.service.dto.MenuAccountDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author psy
 * @since 2022-06-28
 */
@RestController
@RequestMapping("/menuInfo")
@Api(tags = "后台菜单操作接口")
public class MenuInfoController {

    @Autowired
    private MenuInfoService menuInfoService;
    /**
     * 超级管理员给商家授权菜单时加载所有菜单的接口
     * @param roleId
     * @return
     */
    @ApiOperation("超级管理员给商家授权菜单时加载所有菜单的接口")
    @ApiImplicitParam(name = "roleId",value = "角色id")
    @GetMapping("/loadMenus/{roleId}")
    public Result loadMenus(@PathVariable("roleId") Integer roleId) {

        MenuAccountDto menuAccountDto = menuInfoService.loadMenus(roleId);

        return Result.success(200,"查询授权菜单信息成功",menuAccountDto);
    }

}

